<script lang="ts">
  // Greeter.svelte
  import { dispatch } from "$lib/tauri";
  import { selectOnFocus } from '$lib/js/actions.js'
  import { tooltip } from '$lib/js/tooltip'

  let greet = "Hello Ken 31";

  async function onclick() {
    greet = await dispatch("greet", {
      name: "Alice",
      age: 32,
    });
    console.log("~>", greet);
    //=> "~> Hello Alice, 32 year-old human!"

    await dispatch("log111", { message: "Hello EBMaster!" });

    await dispatch("plugin:log|hello", { message: "Hello Log Plugin!" });
    await dispatch("plugin:sqlite|hello", { message: "Hello Sqlite Plugin!" });
  }

  async function onclick1() {
    let endpoint = await dispatch("get_actix_graphql_endpoint");
    console.log("endpoint=",endpoint);
  }
</script>

input 1: <input type="text" use:selectOnFocus>

input 2: <input type="text">

<button on:click={onclick} class="rounded-xl bg-black bg-opacity-10">Click Me
  {greet}
</button>
<br />
<button on:click={onclick1}  use:tooltip title="hello world">Read From Database </button>
<br />
<br />
<br />
